Neovim Shortcuts
Movement commands
e move to end of wordw move to start of wordb back to previous word
Visual mode
v to start visual mode<C-v> to start visual block mode<Esc> to exit visual mode
Delete commands
dw to delete worddiw to delete inside worddaw to delete around wordd3w to delete 3 wordsd$ to delete till end of lined0 to delete till start of lined^ to delete till first non-blank character of the line
Change commands
cw to change wordciw to change inside wordcaw to change around wordc3w to change 3 wordsc$ to change till end of linec0 to change till start of linec^ to change till first non-blank character of the line
Yank commands
yw to yank wordyy to yank line
Paste commands
p to paste afterP to paste before
Run any command inside vim
:!ls -alh to run command:!touch file1 to run command and create file
Reading external command output
:r !ls to run command and put output in buffer
Substitution commands
:s/old/new/g to replace all in current line:s/old/new/gc to replace all in current line with confirmation:%s/old/new/g to replace all in the file
advanced example::s/Your mom/you Dad/gc to replace all in the current line with confirmation:%s/Your mom/you Dad/gc to replace all in the file with confirmation
Global (:g) commands
:g/old/d to delete all lines matching pattern
Quit commands
:q to quit:q! to quit without saving
Write commands
:w to write:w !sudo tee to write as root
switch tabs
gt and gT are Vim's shortcuts to jump to next & previous tabs
you can also go to specific tab by index number and then gt
If you already have a Visual Line selection (V)
You can switch to block mode on the fly:
Select lines with V (visual line mode) or vip etc.
Press Ctrl-V to switch to block mode.
Then press I + your text + Esc.
Or use the command-line way after selecting lines:
After visual selection: :'<,'>normal! I#
Common examples
Add # at the start of each line (e.g. for commenting):
Go to column 0 on the first line.
Ctrl-V → select down with j → I# → Esc
Add two spaces at the beginning:
Ctrl-V → select → I (type two spaces) → Esc
Add // (comment in many languages):
Ctrl-V → select → I// → Esc